<!DOCTYPE HTML>
<html lang="en">
<head>
<title>SoundSetWaveVolume - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The SoundSetWaveVolume command changes the wave output volume of a sound device." />
<meta name="ahk:equiv-v2" content="commands/SoundSet.htm" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>SoundSetWaveVolume</h1>

<p>Changes the wave output volume of a sound device.</p>

<pre class="Syntax"><span class="func">SoundSetWaveVolume</span>, Percent <span class="optional">, DeviceNumber</span></pre>
<h2>Parameters</h2>
<dl>

  <dt>Percent</dt>
  <dd><p>Percentage number between -100 and 100 inclusive (it can be a floating point number or an <a href="../Variables.htm#Expressions">expression</a>). If the number begins with a plus or minus sign, the <strong>current volume level</strong> will be adjusted up or down by the indicated amount. Otherwise, the volume  will be set explicitly to the level indicated by <em>Percent</em>.</p></dd>

  <dt>DeviceNumber</dt>
  <dd><p>If this parameter is omitted, it defaults to 1 (the first sound device), which is usually the system's default device for recording and playback. Specify a number higher than 1 to operate upon a different sound device.</p></dd>

</dl>
<h2>Error Handling</h2>
<p><span class="ver">[v1.1.04+]</span>: This command is able to throw an exception on failure. For more information, see <a href="Catch.htm#RuntimeErrors">Runtime Errors</a>.</p>
<p><a href="../misc/ErrorLevel.htm">ErrorLevel</a> is set to 1 if there was a problem or 0 otherwise.</p>
<h2>Remarks</h2>
<p>The current wave output volume level can be retrieved via <a href="SoundGetWaveVolume.htm">SoundGetWaveVolume</a>. Settings such as Master Volume, Synth, Microphone, Mute, Treble, and Bass can be set and retrieved using <a href="SoundSet.htm">SoundSet</a> and <a href="SoundGet.htm">SoundGet</a>.</p>
<p><span class="ver">[v1.1.10+]:</span> On Windows Vista and later, this command is equivalent to <a href="SoundSet.htm">SoundSet</a> with <em>ComponentType</em> set to <code>Wave</code> and <em>ControlType</em> set to <code>Volume</code>. Both commands attempt to preserve the existing balance between channels.</p>
<p>Windows 2000/XP/2003: Unlike <a href="SoundSet.htm">SoundSet</a>, this command attempts to preserve the existing balance between channels (e.g. left and right) when changing the volume level.</p>
<h2>Related</h2>
<p><a href="SoundGetWaveVolume.htm">SoundGetWaveVolume</a>, <a href="SoundSet.htm">SoundSet</a>, <a href="SoundGet.htm">SoundGet</a>, <a href="SoundPlay.htm">SoundPlay</a></p>
<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>SoundSetWaveVolume, 50  <em>; Set the volume to its half-way point.</em>
SoundSetWaveVolume, -10  <em>; Decrease the current  level by 10 (e.g. 80 would become 70).</em>
SoundSetWaveVolume, +20  <em>; Increase the current level by 20.</em></pre>
</div>

</body>
</html>
